package com.ahcloud.edas.gatewaylog.biz.application.helper;

import com.ahcloud.edas.gatewaylog.biz.domain.log.dto.GatewayRequestLogDTO;
import com.ahcloud.edas.gatewaylog.biz.domain.log.vo.GatewayAccessLogDetailVO;
import com.ahcloud.edas.gatewaylog.biz.domain.log.vo.GatewayAccessLogVO;
import com.ahcloud.edas.gatewaylog.biz.infrastructure.repository.bean.GatewayLog;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @program: ahcloud-operatelog
 * @description:
 * @author: YuKai Fan
 * @create: 2024/5/26 22:10
 **/
public class GatewayLogHelper {

    /**
     * 数据转换
     * @param logDTO
     * @return
     */
    public static GatewayLog convert(GatewayRequestLogDTO logDTO) {
        return Convert.INSTANCE.convert(logDTO);
    }

    /**
     * 数据转换
     * @param logDTOList
     * @return
     */
    public static List<GatewayLog> convertList(List<GatewayRequestLogDTO> logDTOList) {
        return Convert.INSTANCE.convertList(logDTOList);
    }

    /**
     * 数据转换
     * @param gatewayLogList
     * @return
     */
    public static List<GatewayAccessLogVO> convertToVOList(List<GatewayLog> gatewayLogList) {
        return Convert.INSTANCE.convertToVOList(gatewayLogList);
    }

    /**
     * 数据转换
     * @param gatewayLog
     * @return
     */
    public static GatewayAccessLogDetailVO convertToDetailVO(GatewayLog gatewayLog) {
        return Convert.INSTANCE.convertToDetailVO(gatewayLog);
    }

    @Mapper
    public interface Convert {
        Convert INSTANCE = Mappers.getMapper(Convert.class);

        /**
         * 数据转换
         * @param logDTO
         * @return
         */
        GatewayLog convert(GatewayRequestLogDTO logDTO);


        /**
         * 数据转换
         * @param logDTOList
         * @return
         */
        List<GatewayLog> convertList(List<GatewayRequestLogDTO> logDTOList);

        /**
         * 数据转换
         * @param gatewayLog
         * @return
         */
        GatewayAccessLogVO convertToVO(GatewayLog gatewayLog);

        /**
         * 数据转换
         * @param gatewayLogList
         * @return
         */
        List<GatewayAccessLogVO> convertToVOList(List<GatewayLog> gatewayLogList);


        /**
         * 数据转换
         * @param gatewayLog
         * @return
         */
        GatewayAccessLogDetailVO convertToDetailVO(GatewayLog gatewayLog);
    }
}
